package com.ssy.lingxi.marketing.model.bo;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * 活动商品价格和活动标签BO
 * @author yzc
 * @version 2.0.0
 * @date 2021/9/1
 */
@Getter
@Setter
public class ActivityGoodsTagBO implements Serializable {

    private static final long serialVersionUID = 5781776047672118132L;

    /**
     * 活动商品id
     */
    private Long activityGoodsId;
    /**
     * 活动id
     */
    private Long activityId;

    /**
     * 所属类型
     */
    private Integer belongType;

    /**
     * 活动类型: 1-特价促销 2-直降促销 3-折扣促销 4-满量促销 5-满额促销
     *         6-赠送促销 7-多件促销 8-组合促销 9-拼团 10-抽奖
     *         11-砍价 12-秒杀 13-换购 14-预售 15-套餐 16-试用
     */
    private Integer activityType;

    /**
     * 活动定义
     */
    private ActivityDefinedBO activityDefinedBO;

    /**
     * 活动开始时间
     */
    private Long startTime;

    /**
     * 活动结束时间
     */
    private Long endTime;

    // ==============================标签==============================
    //         -------------------
    //         |                 |
    //         |    商品主图     |
    //         |                 |
    //         -------------------
    // 活动标签(activityTypeTag) [标签1] [标签2] [标签3]
    // 优惠标签(preferentialTag - preferentialTagDesc)
    //         (preferentialTag - List<PreferentialLadder>)
    //          [标签1 - 描述1]
    //          [标签2 - 描述2]
    //          [标签3 - 描述3]
    // ===============================================================

    /**
     * 活动标签
     */
    private String activityTypeTag;

    /**
     * 优惠标签
     */
    private String preferentialTag;

    /**
     * 优惠标签描述
     */
    private String preferentialTagDesc;

    /**
     * 梯度优惠标签描述
     */
    private List<PreferentialLadder> preferentialLadderList;

    /**
     * 优惠梯度条目
     * 例子1: limit - desc
     * 2 - "满2件总价减5元"
     * 3 - "满3件总价减10元"
     * 100.00 - "满100元减10元"
     * 200.00 - "满300元减20元"
     *
     * 例子2: limit - items
     * 100.00 - [{"desc": "商品名称1", "num": 1}, {"desc": "商品名称2", "num": 2}]
     * 解释: 满足100元门槛, 可对items中元素做某些操作
     * 1 - [{"desc": "商品名称1", "num": 1}, {"desc": "商品名称2", "num": 2}]
     * 解释: 满足数量1门槛, 可对items中元素做某些操作
     */
    @Setter
    @Getter
    @AllArgsConstructor
    @NoArgsConstructor
    public static class PreferentialLadder {
        /**
         * 描述
         */
        private String desc;
        /**
         * 优惠门槛
         */
        private BigDecimal limit;
        /**
         * 优惠梯度子项
         */
        private List<Item> items;
    }

    /**
     * 优惠梯度子项
     * {"desc": "商品名称1", "num": 1}, {"desc": "商品名称2", "num": 2}
     */
    @Setter
    @Getter
    @AllArgsConstructor
    @NoArgsConstructor
    public static class Item {
        /**
         * 描述
         */
        private String desc;
        /**
         * 数量
         */
        private BigDecimal num;
    }
}
